package com.example.springboot_zc.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.springboot_zc.Utils.Result;
import com.example.springboot_zc.mapper.userMapper;
import com.example.springboot_zc.pojo.User;
import com.example.springboot_zc.service.userService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional(rollbackFor = Exception.class)
@Service
public class userServiceImpl extends ServiceImpl<userMapper, User> implements userService {

    @Autowired
    userMapper userMapper;


    public User findName(String name){
        return userMapper.findName(name);
    }

    public Integer updatapassword(String username,String idcard){
        return userMapper.updatapassword(username,idcard);
    }

    public Integer updataps(String username,String password){
        return userMapper.updatapa(username,password);
    }

    public Result UpdateFileName(String filename, String username){
        Boolean res = userMapper.UpdateFileName(filename, username);

        if(res)
            return Result.success("Insert success!");
        return Result.fail(20001,"插入失败");
    }

    public Integer updataMine(String phone,String address,String username){
        return userMapper.updataMine(phone, address, username);
    }
}
